/*
 * @Author: 张小平
 * @Date:   2025-05-01
 * @Email:  qqshuqian@163.com
 * @Copyright © 2024 aseyun. All rights reserved.
 */
import request from '@/framework-core/axios';
import website from '@/framework-core/config/website';


const apiProcAdd = (postdata) => {
  return request.post(website.baseCodeApiUrl +'/api/flow/proc', postdata)
}

const apiProcEdit = (postdata) => {
  return request.put(website.baseCodeApiUrl +'/api/flow/proc', postdata)
}

const apiProcDel = (id) => {
  return request.delete(website.baseCodeApiUrl + `/api/flow/proc/${id}`)
}

const apiProcModelGet = (params) => {
  return request.get(website.baseCodeApiUrl + '/api/flow/proc/model', {
    params
  })
}

const apiProcModelSave = (postdata) => {
  return request.post(website.baseCodeApiUrl + '/api/flow/proc/model-save', postdata)
}

const apiProcModelImport = (postdata) => {
  return request.post(website.baseCodeApiUrl + '/api/flow/proc/model-import', postdata)
}

const apiProcModelPublish = (procId) => {
  return request.put(website.baseCodeApiUrl + '/api/flow/converter/release', null, { params: { procId }})
}

const apiProcModelPublish2 = (procId) => {
  return request.post(website.baseCodeApiUrl + '/repository/deploy-by-id', null, { params: { accessCondition: '', id: procId }})
}

const apiProcModelMode2 = (procId) => {
  return request.put(website.baseCodeApiUrl + '/api/flow/converter/to-flow-able', null, { params: { procId }})
}


const apiProcStart= (processDefinitionKey,businessKey) => {
  return request.post(website.baseCodeApiUrl + '/api/flow/flow-ext/start-process-instance-by-key',    {"processDefinitionKey":processDefinitionKey,"businessKey":businessKey}, { params: {   processDefinitionKey,
      businessKey}})
}



export default {
  apiProcAdd,
  apiProcEdit,
  apiProcDel,
  apiProcModelGet,
  apiProcModelSave,
  apiProcModelImport,
  apiProcModelPublish,
  apiProcModelPublish2,
  apiProcModelMode2,
  apiProcStart
}
